import { CellRenderer } from "../../../../../fl/controls/listClasses/CellRenderer";
import { ResouceConst } from "../../../../component/gconst/ResouceConst";
import { GTextFormat } from "../../../../common/GTextFormat";
import { FontUtil } from "../../../../common/font/FontUtil";
import { ObjCreate } from "../../common/ObjCreate";
import { NewBFTopData } from "../cellData/NewBFTopData";
import { GameDefConfig } from "../../../resource/GameDefConfig";
import { PlayerUtil } from "../../common/util/PlayerUtil";
import { HTMLUtil } from "../../../../../com/gengine/utils/HTMLUtil";
import { ScaleBitmap } from "../../../../../com/mui/display/ScaleBitmap";
//class NewBFScoreCellRenderer
    
    export  class NewBFScoreCellRenderer extends CellRenderer
    {
        constructor()
        {
            super();
            this.init();
            return;
        }

        /* internal  */init(): void
        {
            this.initStyle();
            this.createChildren();
            this.addListeners();
            return;
        }

        /* internal  */initStyle(): void
        {
            this.setStyle("downSkin", new Object /* flash.display.Bitmap */());
            this.setStyle("overSkin", new Object /* flash.display.Bitmap */());
            this.setStyle("upSkin", new Object /* flash.display.Bitmap */());
            this.setStyle("selectedDownSkin", new Object /* flash.display.Bitmap */());
            this.setStyle("selectedOverSkin", new Object /* flash.display.Bitmap */());
            this.setStyle("selectedUpSkin", new Object /* flash.display.Bitmap */());
            return;
        }

        /* internal  */createChildren(): void
        {
            this._line = ResouceConst.getScaleBitmap("SplitLine");
            this._line.width = 490;
            this._line.height = 2;
            this.addChild(this._line);
            var loc1=new GTextFormat(FontUtil.songtiName, 12, 11661311);
            loc1.align = flash.text.TextFormatAlign.CENTER;
            this._tfRank = ObjCreate.createTextField("", 0, 6, 40, 20, this, loc1);
            this._tfName = ObjCreate.createTextField("", 40, 6, 120, 20, this, loc1);
            this._tfCamp = ObjCreate.createTextField("", 160, 6, 60, 20, this, loc1);
            this._tfKillUser = ObjCreate.createTextField("", 220, 6, 50, 20, this, loc1);
            this._tfAssists = ObjCreate.createTextField("", 270, 6, 50, 20, this, loc1);
            this._tfContinuityKill = ObjCreate.createTextField("", 320, 6, 50, 20, this, loc1);
            this._tfContinuityHonour = ObjCreate.createTextField("", 370, 6, 60, 20, this, loc1);
            this._tfTotleHonor = ObjCreate.createTextField("", 430, 6, 60, 20, this, loc1);
            return;
        }

        /* internal  */addListeners(): void
        {
            return;
        }

        public /* override */ set data(arg1: Object)
        {
            if (typeof arg1 === "newbftopdata") 
            {
                this._topData = arg1 as NewBFTopData;
                this.updateView();
            }
            return;
        }

        /* internal  */updateView(): void
        {
            var loc1=GameDefConfig.instance.getForceShort(this._topData.playerScore.force);
            this._tfRank.text = this._topData.rank.toString();
            this._tfName.htmlText = "[" + PlayerUtil.getProxyMsg(this._topData.playerScore.entityId) + "] " + HTMLUtil.addColor(this._topData.playerScore.name, loc1.text1);
            this._tfCamp.htmlText = HTMLUtil.addColor(loc1.name, loc1.text1);
            this._tfKillUser.text = this._topData.playerScore.fightHonour.toString();
            this._tfAssists.text = this._topData.playerScore.towerHonour.toString();
            this._tfContinuityKill.text = this._topData.playerScore.protectTowerHonour.toString();
            this._tfContinuityHonour.text = this._topData.playerScore.winHonour.toString();
            this._tfTotleHonor.text = this._topData.playerScore.honour.toString();
            return;
        }

        public /* override */ set label(arg1: string)
        {
            return;
        }

        /* internal */ /* var */_line: ScaleBitmap;

        /* internal */ /* var */_tfRank: Object /* flash.text.TextField */;

        /* internal */ /* var */_tfName: Object /* flash.text.TextField */;

        /* internal */ /* var */_tfCamp: Object /* flash.text.TextField */;

        /* internal */ /* var */_tfKillUser: Object /* flash.text.TextField */;

        /* internal */ /* var */_tfAssists: Object /* flash.text.TextField */;

        /* internal */ /* var */_tfContinuityKill: Object /* flash.text.TextField */;

        /* internal */ /* var */_tfTotleHonor: Object /* flash.text.TextField */;

        /* internal */ /* var */_tfContinuityHonour: Object /* flash.text.TextField */;

        /* internal */ /* var */_topData: NewBFTopData;
    }
